Feat viterbi#232
Closed
Prathameshk2024 wants to merge 7 commits intoTheAlgorithms:masterfrom
Closed
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds an implementation of the Viterbi Algorithm for Hidden Markov Model (HMM) decoding. The algorithm finds the most probable sequence of hidden states given observed events using dynamic programming.
Key Changes
- Implements the core Viterbi algorithm with initialization, recursion, and backtracking steps
- Provides a complete working example using a weather prediction scenario
- Includes comprehensive documentation explaining the algorithm, complexity, and usage
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
|
It's already implemented here quantitative_finance/hidden_markov_model.r under a different name. Please correct if they are different |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This R program implements the Viterbi Algorithm — a dynamic programming method used in Hidden Markov Models (HMMs) to find the most probable sequence of hidden states that could have produced a given sequence of observed events.
It works in three main steps:
Initialization: Calculates initial probabilities for each state using start and emission probabilities.
Recursion: Iteratively updates probabilities for each observation by considering all possible previous states.
Backtracking: Reconstructs the most likely state sequence from the stored backpointers.
Use case: Speech recognition, weather prediction, bioinformatics (e.g., gene sequence analysis).
Time Complexity: O(N × T)
Space Complexity: O(N × T)